<template>
  <!--  高亮-->
  <div v-if="type==='highlight'" class="form-block-title-container">
    <el-tag v-if="row.status===statusUtil.REJECT" type="danger">{{ statusFormat(row) }}</el-tag>
    <el-tag v-else-if="row.status===statusUtil.NOT_SUBMIT" type="warning">{{ statusFormat(row) }}</el-tag>
    <el-tag v-else-if="row.status===statusUtil.APPROVED || row.status===statusUtil.FINISH" type="success">
      {{ statusFormat(row) }}
    </el-tag>
    <el-tag v-else-if="row.status===statusUtil.REVIEW">
      {{ statusFormat(row) }}
    </el-tag>
    <el-tag v-else-if="row.status===statusUtil.CANCEL" type="info">
      {{ statusFormat(row) }}
    </el-tag>
    <el-tag v-else>-</el-tag>
  </div>
  <!--  普通模式-->
  <div v-else-if="type==='normal'">
    <div v-for="item in statusOptions" v-if="row.status===item.dictValue">{{ item.dictLabel }}</div>
  </div>
</template>

<script>

import * as statusUtil from '@/components/StatusValueToText/statusUtil'

export default {
  name: 'StatusValueToText',
  props: {
    row: {
      required: true,
      type: Object
    },
    type: {
      required: false,
      type: String,
      default: 'normal'
    }
  },
  data() {
    return {
      statusOptions: []
    }
  },
  created() {
    this.statusOptions = statusUtil.statusArray
  },
  methods: {
    // 状态字典翻译
    statusFormat(row, column) {
      return this.selectDictLabel(this.statusOptions, row.status)
    }
  }
}

</script>

<style scoped>
</style>
